import numpy as np
import cv2
from matplotlib import pyplot as plt
from scipy import ndimage
from helper import plotMatches

from matchPics import matchPics

# Read the image and convert to grayscale, if necessary
if __name__ == "__main__":
    data = []
    for i in range(36):
        i1 = cv2.imread('cover.jpg', 1)
        i2 = ndimage.rotate(i1, i * 10)
        matches, locs1, locs2 = matchPics(i1, i2)
        plotMatches(i1, i2, matches, locs1, locs2)
        for j in range(len(matches)):
            data.append(i * 10)
        plt.hist(data, 36)
        plt.show()
